﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Text;

namespace kim.Web.rpp0717.Xmloperating
{
    public partial class List : kim.UI.ManagePage
    {
        protected StringBuilder strlist;
        protected int typeid;
        protected void Page_Load(object sender, EventArgs e)
        {
            typeid = kim.Common.KIMRequest.GetInt("typeid", 1);
            LoadXml();
            Label1.Text = "标签云";
        }
        protected void LoadXml()
        {
            string strPath = "~/flash"+typeid+"/tagcloud.xml";
            XmlDocument xmlDoc = new XmlDocument();
            List<Model.tagXml> xmlList=new List<Model.tagXml>();
            string xmlPath = Server.MapPath(strPath);
            xmlDoc.Load(xmlPath);
            XmlNodeList nodeList=xmlDoc.SelectSingleNode("tags").ChildNodes;
            
            foreach (XmlNode xn in nodeList)
            {
                Model.tagXml moxml = new Model.tagXml();
                XmlElement xe=(XmlElement)xn;
                moxml.Id = xe.GetAttribute("id");
                moxml.Style = xe.GetAttribute("style");
                moxml.Href = xe.GetAttribute("href");
                moxml.Value=xe.InnerText;
                xmlList.Add(moxml);
            }
            strlist = new StringBuilder();
            foreach (Model.tagXml mo in xmlList)
            {
                strlist.Append(" <tr><td align=\"center\">");
                strlist.AppendFormat("<font color=\"#0066ff\">标题：{0}</font>",mo.Value);
                strlist.Append("</td>");
                strlist.Append("<td align=\"center\">");
                strlist.AppendFormat("{0}", mo.Href);
                strlist.Append("</td>");
                strlist.Append("<td align=\"center\">");
                strlist.AppendFormat("<span><a href=\"AddorEdit.aspx?type=Edit&id={0}&typeid={1}\">修改</a></span>", mo.Id,this.typeid);
                strlist.AppendFormat("&nbsp;&nbsp;<span><a href=\"AddorEdit.aspx?type=Delete&id={0}&typeid={1}\">删除</a></span>", mo.Id, typeid);
                strlist.Append("</td></tr>");
               
            }
        }
    }
}